package com.miyake.dsp.generator;

public class GaussGenerator {

	private double[] xarr;
	private double[] yarr;
	
	public GaussGenerator(double sigma, double mu, int points, int n) {
		xarr = new double[points];
		yarr = new double[points];
		double range = sigma * n;
		double step = range / xarr.length;
		double xmin = -range / 2.0 + mu;
		for (int i = 0; i < xarr.length; i++) {
			xarr[i] = xmin + (double)i * step;
			yarr[i] = 1.0 / Math.sqrt(2.0*Math.PI*Math.pow(sigma, 2.0)) *
					Math.exp(-1.0 * 
							Math.pow((xarr[i] - mu), 2.0)/(2.0 * Math.pow(sigma, 2.0)));
		}
	}

	public double[] getX() {
		return xarr;
	}

	public double[] getY() {
		return yarr;
	}

}
